/**
 * PageWorkspace
 */

{
  Vue.directive('enter', {
    bind: function (el, binding) {
      let ime = false;
      el.addEventListener('keyup', (e) => {
        let handler = binding.value;
        if (e.key === 'Enter' && !ime) {
          handler();
        }
      });
      el.addEventListener('compositionstart', (e) => {
        ime = true;
      });
      el.addEventListener('compositionend', (e) => {
        ime = false;
      });
    }
  });
}